<template>
  <div class="pageWrapper">
    <common-header />
    <div class="card">
      <div class="title-wrap">
        <div class="title">结果异议反馈</div>
        <div class="status during" v-if="content.dissentStatus == 1">处理中</div>
        <div class="status finished" v-else-if="content.dissentStatus == 2">处理完成</div>
        <div class="status unhandled" v-else>未处理</div>
      </div>
      <div>
        <div class="item" v-for="item in content.resultContentVOList" :key="item.id">
          <div class="name-wrap">
            <div class="name">{{ item.userName }}</div>
            <div class="time">{{ item.createTime | timeFormat }}</div>
          </div>
          <div class="content">
            {{ item.resultContent }}
          </div>
        </div>
      </div>
    </div>
    <div class="add-btn btn-active" @click="linkAdd">结果异议反馈</div>
    <div class="block"></div>
  </div>
</template>

<script>
import { getObjectionResultList } from "@/api/objectionHandle";
import { formatTime } from "@/utils";
export default {
  data() {
    return {
      form: {
        appraisalId: 0,
        dissentType: 1 //考核类型（1：平时考核 2：年度考核）,
        // userType: 1 //用户类型（1：提交异议申请人 2：处理异议人）
      },
      content: {}
    };
  },
  filters: {
    timeFormat(time) {
      return formatTime(new Date(time), "yyyy年MM月dd日 HH:mm:ss");
    }
  },
  created() {
    this.form.appraisalId = this.$route.query.id;
    this.form.dissentType = this.$route.query.is_year == "1" ? 2 : 1;
    this.initData();
  },
  methods: {
    initData() {
      getObjectionResultList(this.form).then(res => {
        if (res.data) {
          this.content = res.data;
        }
      });
    },
    linkAdd() {
      this.$router.push({
        path: "/appraisalResults/feedbackAdd",
        query: {
          from: "list",
          oid: this.content.id,
          is_year: this.$route.query.is_year
        }
      });
    }
  }
};
</script>

<style scoped lang="scss">
.card {
  margin: 20px 16px;
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  .title-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    .title {
      font-size: 16px;
      color: #000;
    }
    .status {
      line-height: 26px;
      border-radius: 4px;
      font-size: 12px;
      padding: 0 10px;
    }
    .during {
      color: #ffa700;
      background: rgba(255, 167, 0, 0.1);
    }
    .finished {
      color: #1b68eb;
      background: rgba(27, 104, 235, 0.1);
    }
    .unhandled {
      color: #808080;
      background: rgba(128, 128, 128, 0.1);
    }
  }
  .item {
    border-bottom: 1px solid #ebebeb;
    padding-bottom: 12px;
    &:last-child {
      border: none;
      padding-bottom: 0;
    }
  }
  .name-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 20px;
    .name {
      color: #4d4d4d;
    }
    .time {
      color: #b3b3b3;
    }
  }
  .content {
    font-size: 14px;
    line-height: 22px;
    color: #808080;
  }
}
.add-btn {
  position: fixed;
  left: 16px;
  bottom: 64px;
  width: 343px;
  text-align: center;
  line-height: 52px;
  border-radius: 12px;
  color: #fff;
  background: #2492ff;
  font-size: 14px;
}
.block {
  height: 140px;
}
</style>
